package mainframe;

import java.awt.Component;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;



import javax.swing.JFileChooser;

public class OpenFile {
	private String[] asmArray;
	private int asmLen;
	OpenFile(){
		asmLen = 0;
		asmArray = new String[1024];
	}
	void doModel(Component parent){
		JFileChooser chooser = new JFileChooser();
		try {
			int returnVal = chooser.showOpenDialog(parent);
			if (returnVal ==JFileChooser.APPROVE_OPTION ){
				File openfile = chooser.getSelectedFile();
				BufferedReader input = new BufferedReader (new FileReader(openfile)) ;
				String str=input.readLine();
				while (str!=null){
					asmArray[asmLen++]=str;
					str = input.readLine();
				}
				input.close();
			}
		}catch(Exception e){
			System.out.println(e);
		}
	}
	
	String[] getAsmArray(){
		return asmArray;
	}
	int getAsmLen(){
		return asmLen;
	}

}
